<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			window.onload=function()
			{
				
				var num=1; 
				var timer=setInterval(function(){
					var box1=document.getElementById("box1");
				     box1.innerHTML=num++;   //先输出1
					 if(num>20)
					 {
						 clearInterval(timer);
					 }
				},1000)
				
					
				
			}
		</script>
	</head>
	<body>
		<h1 id="box1"></h1>
	</body>
</html>